package com.wintrue.ffxs.http;

import android.content.Context;
import android.text.TextUtils;

import com.wintrue.ffxs.base.MApplication;
import com.wintrue.ffxs.receiver.NetworkStateReceiver;
import com.wintrue.ffxs.utils.DateUtil;

import java.util.Date;
import java.util.Map;
import java.util.UUID;

/**
 * Created by lhe on 2017/8/14.
 */

public class HttpTaskUtil {

    public static void addGlobParams(Map<String, Object> params, Context mContext) {
        String date = DateUtil.dateToStr(new Date(), "yyyy-MM-dd HH:mm:ss");
//        String data = JSON.toJSONString(mDataTemps);
//        LogUtil.e("data", data);
//        try {
//            data = Des3.des3EncodeCBC(AppConfig.DES3_KEY, AppConfig.DES3_IV, data);
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//        params.put("data", data);
        String requestId = UUID.randomUUID().toString();
        params.put("token", TextUtils.isEmpty(MApplication.getInstance().getUser().getToken()) ? "" : MApplication.getInstance().getUser().getToken());
        params.put("passed", "1");
        params.put("passed_type", "3DES");
        params.put("dev", MApplication.getInstance().getDeviceInfo());
        params.put("sign_type", "MD5");
        params.put("did", MApplication.getInstance().getAppUniqueID());
        params.put("versionCode", MApplication.getInstance().getVersionCode());
        params.put("version", MApplication.getInstance().getVersion());
        params.put("net", NetworkStateReceiver.getNetworkType(mContext));
        params.put("timestamp", date);
        params.put("Accept", "application/json");
        params.put("apptype", "1");
        params.put("ostype", "1");
        params.put("requestid",requestId);
    }
}
